<template>
	<view style="padding: 30rpx 20rpx;">
		<view class="row">
			<image src="/static/index/WeChat.png" mode=""></image>
			<view class="column" style="margin-left: 30rpx;align-items: flex-start;justify-content: center;">
				<view class="">
					关注公众号免费领取环保袋
				</view>
				<view class="button" @click="authorizationMessage">
					去关注
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				
			};
		},
		methods:{
			authorizationMessage(){
				var SubscribeMessage = plus.android.importClass("com.tencent.mm.opensdk.modelbiz.SubscribeMessage");
				console.log(SubscribeMessage)
				var subsMessageReq = new SubscribeMessage.Req();
				subsMessageReq.plusSetAttribute("scene", 1234); // 随便一个整数，0-10000以内
				subsMessageReq.plusSetAttribute("templateID", "h0QaI6rFI8z2yuSSlY1s4ah2UANzGwVD4lKmfLXjcV0"); // 在微信开放后台，可以查看自己应用的APPID对应的templateID
				
				var IWXAPI = plus.android.importClass("com.tencent.mm.opensdk.openapi.IWXAPI");
				var WXAPIFactory = plus.android.importClass("com.tencent.mm.opensdk.openapi.WXAPIFactory");
				var wxapi = WXAPIFactory.createWXAPI(plus.android.runtimeMainActivity().getContext(), "wx08bd57edafa2a1b5"); // appid是你自己微信的appid
				
				let authorization = wxapi.sendReq(subsMessageReq);
				console.log("授权状态",authorization)
			}
		},
		onNavigationBarButtonTap(index) {
			console.log(index)
		}
	}
</script>

<style lang="scss">
	page{
		width: 100%;
		height: 100%;
	}
	
	.row{
		image{
			width: 160rpx;
			height: 160rpx;
		}
		.button{
			margin: 15rpx 0rpx;
			width: 200rpx;
			height: 60rpx;
			line-height: 60rpx;
			text-align: center;
			border-radius: 15rpx;
			font-size: 26rpx;
			border: solid 1rpx #07BB0A;
			color: #07BB0A;
		}
	}
</style>
